﻿using System;
using System.Collections.Generic;
using System.Linq;
using DataAccessLibrary.DAL;
using entities;

namespace BusinessLogicLibrary
{
    public class CheckoutModule
    {
        private readonly CheckoutDAO _checkoutDAO = new CheckoutDAO();
        private readonly EmployeeDAO _employeeDAO = new EmployeeDAO();

        
        public List<vBill> GetBill(List<int> checkinId)
        {
            return _checkoutDAO.SelectBill(checkinId);
        }

        public List<vBill> CheckOut(List<int> checkinId, string employeeAccount, string employeePassword)
        {
            Employee employee = _employeeDAO.SelectEmployee(employeeAccount, employeePassword);
            if (!Roles.InternalRoles.Any(s => employee.EmployeePosition == s))
                throw new Exception("Invalid employee");
            return _checkoutDAO.SelectBill(checkinId, employee.EmployeeID);
        }
    }
}